<template lang="">
    <div>
        <!-- 三级联动的全局组件:已经注册为全局组件，不需要引入 -->
        <TypeNav />
        <ListContainer />
        <Recommend />
        <Rank />
        <Like />
        <!-- Floor这个组件：自己在组件内部没有发送请求，数据是父组件给的 -->
        <Floor v-for="(floor, index) in floorList" :key="floor.id" :list="floor" />
        <!-- <Floor /> -->
        <Brand />

        <!-- <button @click="add">点我加1</button>
        <span>仓库数据{{count}}</span>
        <button>点我减去1</button> -->
    </div>
</template>
<script>
// 引入其余的组件
import ListContainer from '@/pages/Home/ListContainer';
import Recommend from '@/pages/Home/Recommend'
import Rank from '@/pages/Home/Rank'
import Like from '@/pages/Home/Like'
import Floor from '@/pages/Home/Floor'
import Brand from '@/pages/Home/Brand'

import { mapState } from "vuex";
export default {
    name: 'HomeIndex',
    components: {
        ListContainer,
        Recommend,
        Rank,
        Like,
        Floor,
        Brand
    },
    mounted() {
        //派发action,获取floor组件的数据
        this.$store.dispatch("getFloorList")
        //获取用户信息在首页进行展示
        //每个页面都要派发一次action，因此放在路由守卫中去全局判断了
        // this.$store.dispatch('getUserInfo')
    },
    computed: {
        // ...mapState(['count'])
        ...mapState({
            floorList:state=>state.home.floorList
        })
    },
    methods: {
        // add(){
        //     //派发action
        //     this.$store.dispatch('add')
        // }
    },
}
</script>
<style lang="" scoped>
    
</style>